﻿using System;
using ThreadedWorkerRoleLib;

namespace MultiThreadedWorkerRole
{
    class SessionStateWorker : WorkerEntryPoint
    {
        protected override int ProcessItems()
        {
            var processedItems = 0;
            foreach (var session in TableStorageDataSource.GetExpiredSessions(applicationName, DateTime.Now))
            {
                TableStorageDataSource.Delete(session);
                processedItems++;
            }
            return processedItems;
        }
    }
}
